﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.DrugTrade.Web;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;

namespace HZ.DrugTrade.Web.Hospitals.Collection
{
    public partial class UnPayList : BasePage
    {
        IBLL_Purchase ip = Factory.BLL_Purchase();
        public UnPayList()
        {
            this.ModuleNo = Module.结算单管理.ToString();
            this.PageOperateType = OperateType.新增.ToString();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        /// <summary>
        /// 获取待结算企业列表
        /// </summary>
        private void BindData()
        {
            //企业名称
            int totalcount = 0;
            string companyName = txtCompanyName.Text.Trim().Replace("'", "");
            //AspNetPager1.PageSize = Constants.GRIDVIEW_PAGE_SIZE;

            try
            {
                //获取待结算企业列表
                IList<Model.Company> companyList = ip.GetUnPayCompanyList(CurrentAccount.GetUser().Org.OrgID, companyName, AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex, out totalcount);
                AspNetPager1.RecordCount = totalcount;
                gvwCompanyList.DataSource = companyList;
                gvwCompanyList.DataBind();
            }
            catch
            {
                HZ.Web.WebUtil.Alert("页面出错！", this);
            }
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            BindData();
        }

        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData();
        }
    }
}
